let data
let datalist
let tabs
export const findfun = function find(obj,Menu) {
	datalist = []
	findMenu(obj,Menu)
	return datalist
}
function findMenu (obj,Menu) {
	if (obj.parentID === '0') {
		datalist.push(obj)
		return
	}else {
		datalist.push(obj)
		tgMenu(obj.parentID,Menu)
		findMenu(data,Menu)
	}
}
function tgMenu (o,list) {
	if(list === null || list.length === 0){
		return
	}else {
		for (let i = 0; i< list.length; i++) {
			if( o === list[i].key){
				data = list[i]
			}else {
				tgMenu(o,list[i].children)
			}
		}
	}
}
function findTabs (o,list) {
	if(list === null || list.length === 0){
		return
	}else {
		for (let i = 0; i< list.length; i++) {
			if( o === list[i].component){
				tabs = list[i]
			}else {
				findTabs(o,list[i].children)
			}
		}
	}
}

export const findtab = function findtab (o,list) {
	tabs = ''
	findTabs(o,list)
	return tabs
}
export default { findfun,findtab}